package gao.xiaolei.dao;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface CopyMethod<T> {

    public List<T> findByAuthorAndProject(String author,String project);

    @Modifying
    @Query("update #{#entityName} set grade=:grade,judge=:judge where id=:id")
    public void updateGrade(@Param("id") String id,
                            @Param("grade") int grade,
                            @Param("judge") String judge);

    public void deleteAllByProject(String project);

    @Query("select id from #{#entityName} where project=:projectId")
    public List<String> findIdsByProject(@Param("projectId") String projectId);
}
